﻿using APP.DTO.Const;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Primitives;

namespace App.API.BaseFilter
{
    /// <summary>
    /// 方法 拦截器
    /// </summary>
    public class FilterAction : ActionFilterAttribute, IActionFilter
    {

        public override void OnActionExecuting(ActionExecutingContext context)
        {
            //string tempPath = context.HttpContext.Request.Path.ToString();
            //var tempArray = tempPath.Split('/');
            //string lastPath = tempArray[tempArray.Length - 1];
            //if (!string.IsNullOrEmpty(lastPath))
            //{
            //    //允许访问方法
            //    return;
            //}


            ////context.Result = new BadRequestObjectResult(new
            ////{
            ////    Code = APICode.AuthorizationFailCode,
            ////    Errors = "返回校验异常"
            ////});
            //throw new Exception("禁止发起请求");


        }
    }
}
